package lianxi3;

public class Rectangle extends Shape{
    private double width;
    private double height;

    public Rectangle() {

    }

    public Rectangle(String color, double width, double height) {
        super(color);
        this.width = width;
        this.height = height;
    }

    @Override
    public double getArea() {
        return width*height;
    }

    @Override
    public double getPer() {
        return (width+height)*2;
    }

    @Override
    public void showAll() {
        System.out.println("该矩形的颜色为："+getColor()+"，面积为："+getArea()+"，周长为："+getPer());
    }
}
